/*
	Copyright (c) 2007, ANYwebcam.com Pty Ltd. All rights reserved.

	The software in this package is published under the terms of the BSD style 
	license, a copy of which has been included with this distribution in the 
	license.txt file.
*/
package com.anywebcam.di.error
{
	/**
	 * Thrown when a cyclic dependency is detected between DIComponent
	 */
	public class CyclicDependencyError extends DIError
	{
		/**
		 * @param key The requested key that triggered the cyclic dependency error
		 * @param stack The stack of keys request prior to the key that triggered the error
		 */
		public function CyclicDependencyError( key:Object, stack:Array )
		{
			super( 'Cyclic dependency detected for:'+ key +', in:'+ stack.join(',') );
			
			_key = key;
			_stack = stack;
		}
		
		/**
		 * @return The requested key that triggered the cyclic dependency error
		 */
		public function get key():Object
		{
			return _key;
		}
		
		/**
		 * @return The stack of keys request prior to the key that triggered the error
		 */
		public function get stack():Array
		{
			return _stack;
		}
		
		private var _key:Object;
		private var _stack:Array;
	}
}